Skip to content

[PWGHF] Fix PID assignment in Xic0 and Omegac0 candidate creator#16352

Merged
fcatalan92 merged 3 commits into
AliceO2Group:masterfrom
mtorresc15:master
May 26, 2026
Merged

[PWGHF] Fix PID assignment in Xic0 and Omegac0 candidate creator#16352
fcatalan92 merged 3 commits into
AliceO2Group:masterfrom
mtorresc15:master

Conversation

@mtorresc15
Copy link
Copy Markdown
Contributor

@mtorresc15 mtorresc15 commented May 22, 2026

This PR fixes the PID assignment passed to getTrackParCovFromKFP() in candidateCreatorXic0Omegac0.cxx.

KFParticle::GetPDG() returns a PDG code, while getTrackParCovFromKFP() expects an o2::track::PID enum. This PR adds a helper function to convert the PDG code to the corresponding PID enum before calling getTrackParCovFromKFP().

@fcatalan92 @jinhyunni

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

O2 linter results: ❌ 0 errors, ⚠️ 0 warnings, 🔕 1 disabled

@github-actions github-actions Bot changed the title Fix PID assignment in Xic0 and Omegac0 candidate creator [PWGHF] Fix PID assignment in Xic0 and Omegac0 candidate creator May 22, 2026
@mtorresc15 mtorresc15 marked this pull request as draft May 22, 2026 16:48
};

// Convert the KFParticle PDG code to the O2 track PID enum needed by getTrackParCovFromKFP()
o2::track::PID::ID getTrackPIDFromPDG(const int pdg)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way this conversion does not exist in some common utilities yet.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vkucera I had a quick look in O2 and O2Physics and I didn't find any common utility. Similar functions are defined in a couple of other places (

int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
and
int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
).
Do you have a concrete common utility that could be used?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the links. I expected this to already exist somewhere close to the declaration of the o2::track::PID::ID but it seems I was wrong.

Comment on lines +103 to +106
case 211:
return o2::track::PID::Pion;
case 321:
return o2::track::PID::Kaon;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use magic numbers.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtorresc15 You can have a look here https://root.cern/doc/v640/TPDGCode_8h.html for the PDG constant definitions.

@fcatalan92 fcatalan92 marked this pull request as ready for review May 25, 2026 16:22
@fcatalan92 fcatalan92 enabled auto-merge (squash) May 26, 2026 08:59
@fcatalan92 fcatalan92 merged commit ceb4a1c into AliceO2Group:master May 26, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pwghf PWG-HF

Development

Successfully merging this pull request may close these issues.

3 participants